<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	{js:jquery}
	<link href="{webroot:public/css/twitter-bootstrap/3.3.7/css/bootstrap.min.css}" rel="stylesheet">
</head>

<body>
<div class="container">
	<table class="table table-bordered">
		<caption>
			<input type='button' class="btn btn-info" onclick="window.location.href='{url:/seller/live_recommend_goods_edit}';" value="添加商品" />
		</caption>

		<colgroup>
			<col width="300px" />
			<col />
			<col width="150px" />
			<col width="150px" />
		</colgroup>

		<thead>
			<tr>
				<th>标题</th>
				<th>商品名称</th>
				<th>排序</th>
				<th>操作</th>
			</tr>
		</thead>
		{if:count($data) > 0}
		<tbody>
			{foreach:items = $data}
			<tr>
				<td>{$item['title']}</td>
				<td>{$item['name']}</td>
				<td>{$item['sort']}</td>
				<td>
					<button type="button" class="btn btn-default glyphicon glyphicon-pencil" alt="编辑" title="编辑" onclick="window.location.href='{url:/seller/live_recommend_goods_edit/id/$item['id']}';"></button>
					<button type="button" class="btn btn-default glyphicon glyphicon-remove" alt="删除" title="删除" onclick="delGoods({$item['id']})"></button>
				</td>
			</tr>
			{/foreach}
		</tbody>
		{else:}
		<tfoot>
		<tr>
			<th colspan="4">
				对不起，没有找到数据
			</th>
		</tr>
		</tfoot>
		{/if}
	</table>
</div>
</body>
<script>
function delGoods(id) {
	$.getJSON("{url:/seller/live_recommend_goods_del}",{"id":id},function(json)
	{
		if(json.result == 'success')
		{
			window.location.reload();
		}
		else
		{
			alert('删除失败');
		}
	});
}
</script>
</html>